<?php
/** require:
 *  __PHY_LIB
 */
require_once(__PHY_LIB . "/class/Item.class.php");

class News extends Item {
/// definition and constructor ///
	function News($id=0, $field="") {
		Query::Query();
		$this->cfgKeyField("id");
		$this->cfgAllField("id,nation,title,description,year_added,month_added,date_added");
		$this->cfgTable("unit_news");
		if ("" == $field || "*" == $field) {
			$this->cfgField($this->mAllField);
		}
		else {
			$this->cfgField($field);
		}
		if (0 < $id) {
			$this->cfgWhere($this->mKeyField . "=" . $id);
			$this->load();
		}
		else {
			$this->set($this->mKeyField, $id);
		}
	}

	function invalid() {
		return false;
	}

} /// end class News.

class NewsList extends ItemList {
	/// definition and constructor ///
	function NewsList($tablename=null) {
		ItemList::ItemList();
		$this->cfgClass("News");
		$this->cfgKeyField("id");
		$this->cfgAllField("id,nation,title,description,year_added,month_added,date_added");
		$this->cfgTable(null == $tablename ? "unit_news" : $tablename);
	}

} /// end class NewsList.
?>
